/*
 * @Author: 杨三炮
 * @Date: 2021-11-19 11:00:05
 * @LastEditors: 杨三炮
 * @LastEditTime: 2021-11-24 15:59:56
 * @FilePath: \node\node\routers\admin.js
 */
const express = require('express')
const router = express()
const admin = require('../dao/admin_dao')
const passport = require('passport')

router.get('/', (req, res) => res.send('进入admin路由根目录'))
//搜索路由
router.get('/getUsersByTypeAndChar', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.getUserByTypeAndChar(req, res)
})

//发布通知路由
router.post('/announce', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.announce(req, res)
})

//获取所有通知与数量(分页获取)
router.get('/getAllNotice', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.getAllNotice(req, res)
})
//删除通知
router.get('/delNotice', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.delNotice(req, res)
})

//获取班级
router.get('/getClass', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.getClass(req, res)
})
//当前公告查看详情
router.get('/NoticeDetails', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.NoticeDetails(req, res)
})

//获取班级或者专业
router.get('/getClasses', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.getClasses(req, res)
})
//添加班级或者专业
router.post('/addClasses', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.addClasses(req, res)
})
// 模糊查询班级(分页获取数据与数量)
router.get('/searchClasses', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.searchClasses(req, res)
})
//获取xxx的请假条
router.get('/getuserLeave', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.getuserLeave(req, res)
})
//设置假条通过
router.get('/setLeaveState', passport.authenticate('jwt', { session: false }), (req, res) => {
    admin.setLeaveState(req, res)
})


module.exports = router